package com.cafuc.myapplicationcat;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class CustomDialog extends AppCompatActivity implements View.OnClickListener {
    Button button_Custom_dialog, button_Custom_return;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom_dialog);
        initView();
    }

    private void initView() {
        button_Custom_dialog = findViewById(R.id.button_Custom_dialog);
        button_Custom_dialog.setOnClickListener(this);
        button_Custom_return = findViewById(R.id.button_Custom_return);
        button_Custom_return.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.button_Custom_dialog:
                CommonDialog commonDialog = new CommonDialog(CustomDialog.this);
                commonDialog.setTitle("title");
                commonDialog.setMessage("are u sure");
                commonDialog.setNegtive("cancel");
                commonDialog.setPositive("ok");
                commonDialog.setOnClickBottomListener(new CommonDialog.onClickBottomListener() {
                    @Override
                    public void onPositiveClick() {
                        startActivity(new Intent(CustomDialog.this, CheckBox.class));
//commonDialog.dismiss();
                    }

                    @Override
                    public void onNegtiveClick() {
                        commonDialog.dismiss();
                    }
                });
                commonDialog.show();
                break;
            case R.id.button_Custom_return:
                startActivity(new Intent(CustomDialog.this, MainActivity.class));
                break;
        }

    }
}